const items = document.querySelectorAll('.course-pay .item');
items.forEach((item) => {
	item.addEventListener('click', () => {
		item.classList.add('active');
		items.forEach((otherItem) => {
			if (otherItem !== item) {
				otherItem.classList.remove('active');
			}
		});
	});
});
$('.btn').click(function(){
	var action = $('.course-pay').find('.active').data('action');
	var id = $('.goods-content').data('id');
	var pack = $('.goods-content').data('pack');
	$.ajax({
		url: '/orders/create',
		data: {id: id, action: action, pack: pack},
		type: 'post',
		success: function(data){
			if (data.code == 400){
				layer.msg(data.msg);
			}else{
				location.href = '/orders/shows/'+data.id+'.html';
			}
		}
	});
});